import { fromJS } from 'immutable'
import * as actionTypes from './actionTypes'

const defaultState = fromJS({
  articleList: [],
  topicList: []
})

export default (state = defaultState, action) => {
  switch(action.type) {
    case actionTypes.FETCH_ARTICLE_SUCCESS: 
      return state.set('articleList', action.payload)
    case actionTypes.FETCH_TOPIC_SUCCESS: 
      return state.set('topicList', action.payload)
    default: return state
  }
}
